home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / demos / VGX / morph / README < prev    next >
Encoding:
Text File  |  1994-08-02  |  8.0 KB  |  151 lines

  1. ------------------------------------------------------------------------------
  2. - morph - Notes for using the image metamorphosis program.
  3. ------------------------------------------------------------------------------
  4.  
  5. morph takes one optional command-line argument, a master file listing the
  6. image and connection files to be loaded initially.  A sample file "set1" is
  7. included which references some neat images in the "data" directory.  So that
  8. all the files are found correctly, the program should be executed from the
  9. directory containing the "set1" file.
  10.  
  11. To invoke it type
  12.     ./morph set1
  13.  
  14. ------------------------------------------------------------------------------
  15. - Performance -
  16. ------------------------------------------------------------------------------
  17. The program comes up in performance mode.  Pressing keys F1 through
  18. F12 will morph from the current image to that target. As many F-keys will be
  19. active as image/connection file pairs listed in the master file specified on
  20. the command line, plus any pairs added with the "Add Target to List" menu item
  21. in the Edit window.
  22.  
  23. The first target selected fades up from black. Selecting an unused F-key will
  24. fade from the current image to black.
  25.  
  26. The transition speed can be changed by pressing a key on the numeric keypad
  27. on the far right of the keyboard.  Pressing 0 causes changes to happen
  28. instantly, while pressing 9 sets the longest time, about 10 seconds.
  29.  
  30. The program recognizes events, such as window reshapes or popup menus, only
  31. after a transition is completed.  It is possible the queue up several
  32. transitions by pressing the F-Keys several times.  To break out of a
  33. transition at any time and flush the queue, press and hold the Left Ctrl key
  34. until the computer beeps.
  35.  
  36. "morph" has an auto-run mode which is entered by selecting that item from the
  37. popup menu in the Performance window.
  38.  
  39. "Toggle Mesh" controls the display of the underlying triangle mesh used to
  40. draw all the images.  This gives a little insight into how the shape change
  41. happens.
  42.  
  43. "Toggle Twin Images" shows the initial and final images of a transition side-
  44. by-side, instead of dissolving from one to the other.  All dissolves are done
  45. by animating the Alpha value of the color the triangle meshes are drawn in.
  46.  
  47. Selecting "Edit Mode" allows the user to create or modify images or meshes
  48. used in the metamorphosis.
  49.  
  50.  
  51. ------------------------------------------------------------------------------
  52. - Editing -
  53. ------------------------------------------------------------------------------
  54.  
  55. Each image used in the program is rendered by texture mapping a picture onto a
  56. flat mesh made up of triangles.  Each one of a set of pictures uses a triangle
  57. mesh with the same connections as every other, though the vertices may be in
  58. different locations.  Instead of simply cross-dissolving between two images,
  59. each vertex also moves from its location in the first mesh to its location in
  60. the second mesh.  Since the pictures are "attached" to the mesh with a fixed
  61. texture mapping, this causes the images to distort.  If corresponding vertices
  62. of each mesh are placed at corresponding points in each picture - e.g the tip
  63. of the nose to the tip of the nose, the outside of the right eye to the
  64. outside of the right eye - it looks as if the object is changing from one
  65. shape to another.
  66.  
  67. To create a mesh from scratch for a series of images, start with a 256 pixel
  68. square SGI format RGB image file.  For simplicity, the "morph" program only
  69. reads and writes files named "blah", so copy the image file to "blah.rgb".
  70.  
  71. Run "morph" without any arguments and enter Edit mode.  Select "Read file
  72. blah.rgb" from the popup menu.  The image appears in the window.
  73.  
  74. Choose "Add Vertices" from the menu.  Clicking the left mouse button places
  75. new vertices, marked with crosses, on top of the image.  In general, vertices
  76. should go at the points which need to match between images, and enough of them
  77. should be placed around the outside of the shape in the image to completely
  78. cover it with a mesh in the next step.
  79.  
  80. Choose "Add Connections" from the menu.  Now clicking on successive vertices
  81. builds connections between them.  The order in which the vertices are
  82. connected is not important.  To begin a new line of connections, click at
  83. a spot where there are no vertices to break the chain, then begin the new
  84. line.  The Backspace key can be used to erase the last connection made.
  85.  
  86. Different colors for connections and vertices can help distinguish specific
  87. parts of the mesh when you go to associate it with another image.  To change
  88. the color of new vertices or connections, select one from the "Vertex Color" or
  89. "Connection Color" roll-over menu items.  The color of existing vertices and
  90. connections cannot be changed.
  91.  
  92. Choose "Select/Move" from the menu.  Now clicking and dragging with the left
  93. mouse button can be used to move vertices.  Holding down the Shift key
  94. accumulates vertices and connections into the selection.  Clicking and
  95. dragging on a selected vertex moves all selected vertices.  The Backspace
  96. key erases all selected vertices and connections.
  97.  
  98. It is important that connecting lines do not cross each other, and any areas
  99. not covered by a triangle of connected vertices will not be included in the
  100. display.  The mesh may be concave, or in several pieces, or contain holes, if
  101. desired.  To check for problems, select "Draw Triangles" from the popup menu.
  102. This displays a colorful version of the mesh that has been created.  Problems
  103. will show up as empty areas in the colored mesh.  Fix them by moving vertices
  104. or adding or removing connections.  The colored mesh disappears when the mouse
  105. is clicked or a menu item is selected.
  106.  
  107. When a good mesh is obtained, select "Save as blah.cnx" from the menu.  This
  108. saves the location of all the vertices and all connection information into
  109. an ASCII file named "blah.cnx".  Immediately rename the file to keep it from
  110. being overwritten later.
  111.  
  112. In addition to the image and mesh currently being edited, the program keeps a
  113. list of image/mesh pairs.  It is these images that form the targets for
  114. morphing in Performance mode.  To add the current image and mesh to the target
  115. list, select "Add to Target List" from the menu.  To delete one of the targets
  116. from the list, move teh mouse to the "Delete Target from List" menu item.
  117. This is a roll-over menu item, and moving the mouse to the right will display
  118. the list of currently defined targets.  Selecting one will delete it.
  119. "Go to Target" copies one of the targets into the slot for editing.  It is
  120. important to save any editing done on the current image/mesh pair before doing
  121. this.  To make changes to one of the targets in the list, it is necessary to
  122. "Go to Target", make the changes, "Add Target to List", then "Delete Target
  123. from List" to remove the old version.
  124.  
  125. To start the program with a set of image/mesh pairs already in the list,
  126. create an ASCII file with the name of an image file and its mesh file on each
  127. line, like this:
  128.     ...
  129.     data/hippo.rgb data/hippo.cnx
  130.     ...
  131. Supply the name of this file as a command-line argument when starting "morph".
  132.  
  133. To add a mesh to morph into a second image, make sure the first mesh is in
  134. the current editing slot, either having just been created and saved or by
  135. copying the proper .cnx file to "blah.cnx" and selecting "Read file blah.cnx"
  136. from the menu.  Then copy the second image to "blah.rgb" and select "Read file
  137. blah.rgb" from the menu.  The image appears in the editing window under the
  138. old mesh.  Select "Select/Move Vertices" and move the vertices into their
  139. corresponding locations for the new image.  DO NOT delete or add any new
  140. vertices or connections.  If this happens, re-read the "blah.cnx" file and
  141. start over.  Check the validity of the mesh with "Draw Triangles".  If hoels
  142. have appeared, it is because connection lines overlap.  Move vertices until
  143. the mesh is complete.  Select "Save as blah.cnx", rename the file to something
  144. appropriate, then select "Add Target to List" to include the new image and
  145. mesh.  The morph can be tried out immediately by selecting "Performance" from
  146. the menu and pushing F1 and F2 to transition between the two.
  147.  
  148.  
  149.  
  150. 11/26/91 tph
  151.